home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
bbsutil
/
cmpbbs10.zip
/
CMPBBS.BAS
next >
Wrap
BASIC Source File
|
1990-02-26
|
14KB
|
341 lines
DECLARE SUB BreakFileName (FileSpec$, DrvPath$, Prefix$, Extension$, ForJoining%)
DECLARE SUB FindLast (LookIn$, LookFor$, WhereFound%, NumFinds%)
DECLARE SUB TRIM (TRIM.PARM$)
DECLARE SUB TrimTrail (TRIM.PARM$, TRIM.THIS$)
DEFINT A-Z
DIM BBSList$(200), Headers$(200), DirStartCol(200) ' 022490
TRUE = -1
FALSE = 0
FOR I = 1 TO 200 ' 022490
DirStartCol(I) = 1 ' 022490
NEXT ' 022490
MasterStartCol = 1 ' 022490
MasterList$ = "UPLOADS.DIR"
OutFile$ = "NEWFILES.DIR"
NumNewLists = 0
ConfigFile$ = "CMPBBS.CFG"
PassedArguments$ = COMMAND$
PassedArguments$ = UCASE$(PassedArguments$)
X = INSTR(PassedArguments$, "/B")
RunBatch = (X > 0)
IF RunBatch THEN
PassedArguments$ = LEFT$(PassedArguments$, X - 1) + RIGHT$(PassedArguments$, LEN(PassedArguments$) - X - 1)
END IF
X = INSTR(PassedArguments$, "/SHARE")
SHARING = (X > 0)
IF SHARING THEN
PassedArguments$ = LEFT$(PassedArguments$, X - 1) + RIGHT$(PassedArguments$, LEN(PassedArguments$) - X - 1)
END IF
IF PassedArguments$ <> "" THEN
ConfigFile$ = PassedArguments$
END IF
ON ERROR GOTO 40000
IF SHARING THEN
OPEN ConfigFile$ FOR INPUT SHARED AS #1
ELSE
OPEN ConfigFile$ FOR INPUT AS #1
END IF
ON ERROR GOTO 0
WHILE NOT EOF(1)
LINE INPUT #1, A$
X$ = LEFT$(A$, 1)
IF X$ <> "" AND X$ <> "*" THEN
A$ = UCASE$(A$)
IF LEFT$(A$, 12) = "/MASTERLIST=" THEN
MasterList$ = MID$(A$, 13)
CALL TRIM(MasterList$)
END IF
IF LEFT$(A$, 9) = "/ADDLIST=" THEN
NewList$ = MID$(A$, 10)
CALL TRIM(NewList$)
NumNewLists = NumNewLists + 1
BBSList$(NumNewLists) = NewList$
END IF
IF LEFT$(A$, 8) = "/HEADER=" THEN
Headers$(NumNewLists) = MID$(A$, 9)
CALL TRIM(Headers$(NumNewLists))
END IF
IF LEFT$(A$, 9) = "/OUTFILE=" THEN
OutFile$ = MID$(A$, 10)
CALL TRIM(OutFile$)
END IF
IF LEFT$(A$, 6) = "/SHARE" THEN
SHARING = TRUE
END IF
IF LEFT$(A$, 13) = "/DIRSTARTCOL=" THEN ' 022490
X$ = MID$(A$, 14) ' 022490
CALL TRIM(X$) ' 022490
DirStartCol(NumNewLists) = VAL(X$) ' 022490
END IF ' 022490
IF LEFT$(A$, 16) = "/MASTERSTARTPOS=" THEN ' 022490
X$ = MID$(A$, 15) ' 022490
CALL TRIM(X$) ' 022490
MasterStartCol = VAL(X$) ' 022490
END IF ' 022490
IF LEFT$(A$, 10) = "/OUTCATAT=" THEN ' 022690
X$ = MID$(A$, 11) ' 022690
CALL TRIM(X$) ' 022690
OutCatAt = VAL(X$) ' 022690
END IF ' 022690
END IF
WEND
CLOSE 1
PRINT "CMPBBS version 1.0 Feb 26, 1990 copyright (c) 1990 by Ken Goosens"
PRINT "A SysOp utility to compare BBS file lists"
PRINT
PRINT "On this run"
PRINT "Configuration file used ....... "; ConfigFile$
PRINT "Name of master list of files... "; MasterList$
PRINT "File names begin in column....."; MasterStartCol ' 022490
PRINT "# of file lists to process ...."; NumNewLists
PRINT "Writing list of new files to... "; OutFile$
PRINT "Adding category code at column."; ' 022690
IF OutCatAt > 0 THEN ' 022690
PRINT OutCatAt ' 022690
ELSE ' 022690
PRINT " <none>" ' 022690
END IF ' 022690
PRINT
IF NOT RunBatch THEN
INPUT "A to abort, anything else runs"; ANS$
ANS$ = UCASE$(ANS$)
IF ANS$ = "A" THEN
END
END IF
END IF
ON ERROR GOTO 40010
FileIn$ = MasterList$
IF SHARING THEN
OPEN MasterList$ FOR INPUT SHARED AS #1
ELSE
OPEN MasterList$ FOR INPUT AS #1
END IF
ON ERROR GOTO 0
GOSUB BuildCRC
OPEN OutFile$ FOR OUTPUT AS #2
AddToNew = TRUE
NumFilesAdded = 0
FOR ix = 1 TO NumNewLists
PRINT "Processing BBS list "; BBSList$(ix);
ON ERROR GOTO 40100
FileIn$ = BBSList$(ix)
StartCol = DirStartCol(ix) ' 022490
IF SHARING THEN
OPEN BBSList$(ix) FOR INPUT SHARED AS #1
ELSE
OPEN BBSList$(ix) FOR INPUT SHARED AS #1
END IF
ON ERROR GOTO 0
IF ERC > 0 THEN
ERC = 0
PRINT " not found - skipping"
ELSE
CatCode$ = "" ' 022690
IF Headers$(ix) <> "" THEN ' 022690
PRINT #2, " "; Headers$(ix) ' 022690
IF OutCatAt > 0 THEN ' 022690
X = INSTR(Headers$(ix), "M! ") ' 022690
IF X > 0 THEN ' 022690
X$ = MID$(Headers$(ix), X + 3) ' 022690
CALL BreakFileName(X$, DrvPath$, CatCode$, Ext$, 0) ' 022690
CatCode$ = LEFT$(CatCode$, 3) ' 022690
IF LEN(CatCode$) < 3 THEN ' 022690
CatCode$ = CatCode$ + SPACE$(3 - LEN(CatCode$)) ' 022690
END IF ' 022690
END IF ' 022690
END IF ' 022690
END IF ' 022690
GOSUB ProcessList
END IF
NEXT
END
BuildCRC:
WorkName$ = SPACE$(12)
WorkComp$ = WorkName$ ' 022490
CRCMaster$ = ""
FileCRC$ = MKI$(0)
AddToNew = FALSE
PRINT
PRINT "Indexing "; MasterList$;
StartCol = MasterStartCol ' 022490
GOSUB ProcessList
RETURN
ProcessList:
AddedAtStart = NumFilesAdded
NumRead = 0
AddCat = (CatCode$ <> "")
CutOffCat = OutCatAt + LEN(CatCode$) - 1
PrintAt = POS(0) + 1
ON ERROR GOTO 40020
WHILE NOT EOF(1)
4 LINE INPUT #1, A$
NumRead = NumRead + 1
LOCATE , PrintAt
PRINT NumRead;
IF LEN(A$) < StartCol THEN ' 022490
GOTO NotAFile ' 022490
END IF ' 022490
IF StartCol > 1 THEN ' 022490
A$ = MID$(A$, StartCol) ' 022490
END IF ' 022490
IF INSTR("/[]|<>+=;, ?*", LEFT$(A$, 1)) > 0 THEN
GOTO NotAFile
END IF
Y = INSTR(A$ + " ", " ")
IF Y > 13 THEN ' 022690
GOTO NotAFile ' 022490
END IF ' 022490
LSET WorkName$ = A$
X = LEN(A$)
IF X < 12 THEN
MID$(WorkName$, X + 1) = " "
END IF
Y = INSTR(WorkName$, " ")
Z = INSTR(WorkName$, ".")